package com.dylon.seapiweb.controller;

import com.dylon.common.page.TableDataInfo;
import com.dylon.system.domain.SysInterface;
import com.dylon.system.service.ISysInterfaceService;
import lombok.extern.log4j.Log4j2;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/system/interface")
@Log4j2
public class SysInterfaceController extends BaseController {
    private String prefix = "system/interface";

    @Autowired
    ISysInterfaceService interfaceService;

    @RequiresPermissions("system:interface:view")
    @GetMapping()
    public String module()
    {
        return prefix + "/interface";
    }

    @RequiresPermissions("system:interface:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SysInterface sysInterface){
        startPage();
        List<SysInterface> list = interfaceService.selectInterfaceList(sysInterface);
        return getDataTable(list);
    }

    /**
     * 新增接口
     */
    @GetMapping("/add")
    public String add(ModelMap mmap){
        return prefix + "/add";
    }


}
